home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 2.0 Developer Kit / QuickTime 2.0 Developer Kit.iso / mac / MAC / Programming Stuff / Interfaces / PInterfaces / CursorDevices.p < prev    next >
Encoding:
Text File  |  1994-11-11  |  6.4 KB  |  194 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        CursorDevices.p
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a3  ETO #16, MPW prerelease.  Friday, November 11, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. }
  16.  
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT CursorDevices;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __CURSORDEVICES__}
  27. {$SETC __CURSORDEVICES__ := 1}
  28.  
  29. {$I+}
  30. {$SETC CursorDevicesIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33.  
  34. {$IFC UNDEFINED __TYPES__}
  35. {$I Types.p}
  36. {$ENDC}
  37. {    ConditionalMacros.p                                            }
  38.  
  39. {$IFC UNDEFINED __MIXEDMODE__}
  40. {$I MixedMode.p}
  41. {$ENDC}
  42.  
  43. {$PUSH}
  44. {$ALIGN MAC68K}
  45. {$LibExport+}
  46.     
  47. TYPE
  48.     ButtonOpcode = INTEGER;
  49.  
  50. { ButtonOpcodes }
  51.  
  52. CONST
  53.     kButtonNoOp                    = 0;                            { No action for this button }
  54.     kButtonSingleClick            = 1;                            { Normal mouse button }
  55.     kButtonDoubleClick            = 2;                            { Click-release-click when pressed }
  56.     kButtonClickLock            = 3;                            { Click on press, release on next press }
  57.     kButtonCustom                = 6;                            { Custom behavior, data = CursorDeviceCustomButtonUPP }
  58.  
  59. { Device Classes }
  60.     kDeviceClassAbsolute        = 0;                            { a flat-response device }
  61.     kDeviceClassMouse            = 1;                            { mechanical or optical mouse }
  62.     kDeviceClassTrackball        = 2;                            { trackball }
  63.     kDeviceClass3D                = 6;                            { a 3D pointing device }
  64.  
  65. { Structures used in Cursor Device Manager calls }
  66.  
  67. TYPE
  68.     CursorData = RECORD
  69.         nextCursorData:            ^CursorData;                            { next in global list }
  70.         displayInfo:            Ptr;                                    { unused (reserved for future) }
  71.         whereX:                    Fixed;                                    { horizontal position }
  72.         whereY:                    Fixed;                                    { vertical position }
  73.         where:                    Point;                                    { the pixel position }
  74.         isAbs:                    BOOLEAN;                                { has been stuffed with absolute coords }
  75.         buttonCount:            SInt8;                                    { number of buttons currently pressed }
  76.         screenRes:                INTEGER;                                { pixels per inch on the current display }
  77.         privateFields:            ARRAY [0..21] OF INTEGER;                { fields use internally by CDM }
  78.     END;
  79.     CursorDataPtr = ^CursorData;
  80.  
  81.     CursorDevice = RECORD
  82.         nextCursorDevice:        ^CursorDevice;                            { pointer to next record in linked list }
  83.         whichCursor:            ^CursorData;                            { pointer to data for target cursor }
  84.         refCon:                    LONGINT;                                { application-defined }
  85.         unused:                    LONGINT;                                { reserved for future }
  86.         devID:                    OSType;                                    { device identifier (from ADB reg 1) }
  87.         resolution:                Fixed;                                    { units/inch (orig. from ADB reg 1) }
  88.         devClass:                SInt8;                                    { device class (from ADB reg 1) }
  89.         cntButtons:                SInt8;                                    { number of buttons (from ADB reg 1) }
  90.         filler1:                SInt8;                                    { reserved for future }
  91.         buttons:                SInt8;                                    { state of all buttons }
  92.         buttonOp:                ARRAY [0..7] OF SInt8;                    { action performed per button }
  93.         buttonTicks:            ARRAY [0..7] OF LONGINT;                { ticks when button last went up (for debounce) }
  94.         buttonData:                ARRAY [0..7] OF LONGINT;                { data for the button operation }
  95.         doubleClickTime:        LONGINT;                                { device-specific double click speed }
  96.         acceleration:            Fixed;                                    { current acceleration }
  97.         privateFields:            ARRAY [0..14] OF INTEGER;                { fields used internally to CDM }
  98.     END;
  99.     CursorDevicePtr = ^CursorDevice;
  100.  
  101. { for use with CursorDeviceButtonOp when opcode = kButtonCustom }
  102.     {
  103.         CursorDeviceCustomButtonProcPtr uses register based parameters on the 68k and cannot
  104.         be written in or called from a high-level language without the help of
  105.         mixed mode or assembly glue.
  106.  
  107.         In:
  108.          => ourDevice       A2.L
  109.          => button          D3.W
  110.     }
  111.     CursorDeviceCustomButtonProcPtr = ProcPtr;  { PROCEDURE CursorDeviceCustomButton(ourDevice: CursorDevicePtr; button: INTEGER); }
  112.     CursorDeviceCustomButtonUPP = UniversalProcPtr;
  113.  
  114. CONST
  115.     uppCursorDeviceCustomButtonProcInfo = $000ED802; { Register PROCEDURE (4 bytes in A2, 2 bytes in D3); }
  116.  
  117. FUNCTION NewCursorDeviceCustomButtonProc(userRoutine: CursorDeviceCustomButtonProcPtr): CursorDeviceCustomButtonUPP;
  118.     {$IFC NOT GENERATINGCFM }
  119.     INLINE $2E9F;
  120.     {$ENDC}
  121.  
  122. PROCEDURE CallCursorDeviceCustomButtonProc(ourDevice: CursorDevicePtr; button: INTEGER; userRoutine: CursorDeviceCustomButtonUPP);
  123.     {$IFC NOT GENERATINGCFM}
  124.     {To be implemented:  Glue to move parameters into registers.}
  125.     {$ENDC}
  126.  
  127. FUNCTION CursorDeviceMove(ourDevice: CursorDevicePtr; deltaX: LONGINT; deltaY: LONGINT): OSErr;
  128.     {$IFC NOT GENERATINGCFM}
  129.     INLINE $7000, $AADB;
  130.     {$ENDC}
  131. FUNCTION CursorDeviceMoveTo(ourDevice: CursorDevicePtr; absX: LONGINT; absY: LONGINT): OSErr;
  132.     {$IFC NOT GENERATINGCFM}
  133.     INLINE $7001, $AADB;
  134.     {$ENDC}
  135. FUNCTION CursorDeviceFlush(ourDevice: CursorDevicePtr): OSErr;
  136.     {$IFC NOT GENERATINGCFM}
  137.     INLINE $7002, $AADB;
  138.     {$ENDC}
  139. FUNCTION CursorDeviceButtons(ourDevice: CursorDevicePtr; buttons: INTEGER): OSErr;
  140.     {$IFC NOT GENERATINGCFM}
  141.     INLINE $7003, $AADB;
  142.     {$ENDC}
  143. FUNCTION CursorDeviceButtonDown(ourDevice: CursorDevicePtr): OSErr;
  144.     {$IFC NOT GENERATINGCFM}
  145.     INLINE $7004, $AADB;
  146.     {$ENDC}
  147. FUNCTION CursorDeviceButtonUp(ourDevice: CursorDevicePtr): OSErr;
  148.     {$IFC NOT GENERATINGCFM}
  149.     INLINE $7005, $AADB;
  150.     {$ENDC}
  151. FUNCTION CursorDeviceButtonOp(ourDevice: CursorDevicePtr; buttonNumber: INTEGER; opcode: ButtonOpcode; data: LONGINT): OSErr;
  152.     {$IFC NOT GENERATINGCFM}
  153.     INLINE $7006, $AADB;
  154.     {$ENDC}
  155. FUNCTION CursorDeviceSetButtons(ourDevice: CursorDevicePtr; numberOfButtons: INTEGER): OSErr;
  156.     {$IFC NOT GENERATINGCFM}
  157.     INLINE $7007, $AADB;
  158.     {$ENDC}
  159. FUNCTION CursorDeviceSetAcceleration(ourDevice: CursorDevicePtr; acceleration: Fixed): OSErr;
  160.     {$IFC NOT GENERATINGCFM}
  161.     INLINE $7008, $AADB;
  162.     {$ENDC}
  163. FUNCTION CursorDeviceDoubleTime(ourDevice: CursorDevicePtr; durationTicks: LONGINT): OSErr;
  164.     {$IFC NOT GENERATINGCFM}
  165.     INLINE $7009, $AADB;
  166.     {$ENDC}
  167. FUNCTION CursorDeviceUnitsPerInch(ourDevice: CursorDevicePtr; resolution: Fixed): OSErr;
  168.     {$IFC NOT GENERATINGCFM}
  169.     INLINE $700A, $AADB;
  170.     {$ENDC}
  171. FUNCTION CursorDeviceNextDevice(VAR ourDevice: CursorDevicePtr): OSErr;
  172.     {$IFC NOT GENERATINGCFM}
  173.     INLINE $700B, $AADB;
  174.     {$ENDC}
  175. FUNCTION CursorDeviceNewDevice(VAR ourDevice: CursorDevicePtr): OSErr;
  176.     {$IFC NOT GENERATINGCFM}
  177.     INLINE $700C, $AADB;
  178.     {$ENDC}
  179. FUNCTION CursorDeviceDisposeDevice(ourDevice: CursorDevicePtr): OSErr;
  180.     {$IFC NOT GENERATINGCFM}
  181.     INLINE $700D, $AADB;
  182.     {$ENDC}
  183.  
  184. {$ALIGN RESET}
  185. {$POP}
  186.  
  187. {$SETC UsingIncludes := CursorDevicesIncludes}
  188.  
  189. {$ENDC} {__CURSORDEVICES__}
  190.  
  191. {$IFC NOT UsingIncludes}
  192.  END.
  193. {$ENDC}
  194.